using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WqLunTan.Models.DataBase
{
    /// <summary>
    /// 文章内容列表
    /// </summary>
    [Table("article")]
    public class article : BaseUpdateEntity
    {
        /// <summary>
        /// 用户id, 主键
        /// </summary>
        public Guid uid { get; set; }

        /// <summary>
        /// 文章分类表的id, 外键
        /// </summary>
        public Guid cateid { get; set; }

        /// <summary>
        /// 爬虫获取文章表的id, 外键, 原创文章默认为空值
        /// </summary>
        public Guid crawler_id { get; set; }

        /// <summary>
        /// 文章标题
        /// </summary>
        [MaxLength(50)]
        [Required(AllowEmptyStrings = true)]
        public string title { get; set; } = string.Empty;

        /// <summary>
        /// SEO关键字
        /// </summary>
        [MaxLength(50)]
        [Required(AllowEmptyStrings = true)]
        public string keywords { get; set; } = string.Empty;

        /// <summary>
        /// 是否显示
        /// </summary>
        public bool is_show { get; set; }

        /// <summary>
        /// 置顶
        /// </summary>
        public bool top { get; set; }

        /// <summary>
        /// 排序数字
        /// </summary>
        [Range(1, 100)]
        public int sort_num { get; set; } = 100;

        /// <summary>
        /// 文章内容
        /// </summary>
        [Required(AllowEmptyStrings = true)]
        public string content { get; set; } = string.Empty;

        /// <summary>
        /// 图片链接或者相对路径
        /// </summary>
        [MaxLength(255)]
        [Required(AllowEmptyStrings = true)]
        public string img { get; set; } = string.Empty;

        /// <summary>
        /// 上一篇url, 手动输入
        /// </summary>
        [MaxLength(255)]
        [Required(AllowEmptyStrings = true)]
        public string previous_url { get; set; } = string.Empty;

        /// <summary>
        /// 下一篇url, 自动生成
        /// </summary>
        [MaxLength(255)]
        [Required(AllowEmptyStrings = true)]
        public string next_url { get; set; } = string.Empty;
    }
}
